<template>
  <div class="wh">
    <commonshownum :type="'mianji'" :num="numval" :typestr.sync="typestr" :componentDetail="componentDetail"/>
  </div>
</template>
<script>
import commonmixins from "@/mixins/bigScreen/commonmixins";

import dayjs from 'dayjs'

export default {
  mixins: [commonmixins],
  name: "cainuantianshuzzn",
  components: {},
  data() {
    return {
      numval: "0000",
      typestr: "采暖天数",
    };
  },
  computed: {},
  watch: {
    "$store.state.daping.bigScreen": {
      handler: function (n, o) {
        let n_tmp = n;
        let g_bigscreen_data_arr = n_tmp.filter((item) => {
          if (item.attrName == "start_date") {
            return true;
          }
        });
        if (g_bigscreen_data_arr.length != 1) {
          return;
        }
        this.loadData(g_bigscreen_data_arr[0].attrValue);
      },
    },
  },
  mounted() {},
  methods: {
    loadData(st) {
      let days = dayjs().diff(dayjs(st), "day");
      if (days < 0) {
        this.numstr = "供热倒计时";
        this.numval = -days;
      } else {
        this.numval = days;
      }
    },
  },
};
</script>
<style lang='scss' scoped>
</style>